<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>layui</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="../../css/layui.css" media="all">
  <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
</head>
<body>
	
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;">
  <legend>剩余时间</legend>
</fieldset>
<blockquote class="layui-elem-quote" style="margin-top: 10px;">
  <div id="restOfTheTime"></div>
</blockquote>

<form id="testForm" class="layui-form" action="">
	<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
	  <legend>单选题</legend>
	</fieldset>
	
	<blockquote class="layui-elem-quote layui-text"> 
		1.关于sleep()和wait()，以下描述错误的一项是（ ）
	</blockquote>
	
    <div class="layui-form-item">
	    <div class="layui-input-block">
	      <input name="q1" value="1" title="A. sleep是线程类（Thread）的方法，wait是Object类的方法" checked="" type="radio"></br>
	      <input name="q1" value="2" title="B. sleep不释放对象锁，wait放弃对象锁" type="radio"></br>
	      <input name="q1" value="3" title="C. sleep暂停线程、但监控状态仍然保持，结束后会自动恢复"  type="radio"></br>
	      <input name="q1" value="4" title="D. wait后进入等待锁定池，只有针对此对象发出notify方法后获得对象锁进入运行状态"  type="radio">
	    </div>
	</div>
	<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
		<legend>多选题</legend>
	</fieldset>
	<blockquote class="layui-elem-quote layui-text"> 
		2.以下哪些属于传输层协议
	</blockquote>
	<div class="layui-form-item">
		<div class="layui-input-block">
			<input name="q2.1" title="TCP" type="checkbox"></br>
			<input name="q2.2" title="UDP" checked="" type="checkbox"></br>
			<input name="q2.3" title="ARP" type="checkbox">
		</div>
	</div>
	<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
		<legend>简答题</legend>
	</fieldset>
	<blockquote class="layui-elem-quote layui-text"> 
		3.进程与线程有什么区别
	</blockquote>
	<div class="layui-form-item layui-form-text">
		<label class="layui-form-label">请输入答案</label>
			<div class="layui-input-block">
		  	<textarea name="q3" placeholder="请输入内容" class="layui-textarea"></textarea>
		</div>
	</div>
  <div class="layui-form-item">
    <div class="layui-input-block">
      <button id="test" class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
      <button type="reset" class="layui-btn layui-btn-primary">重置</button>
    </div>
  </div>
</form>
 
<script src="../../js/jquery.min.js"></script>
<script src="../../layui.js" charset="utf-8"></script>

<script src="../../js/jquery.serializejson.js" charset="utf-8"></script>
<script>
//	$.ajax({
//				type: "get",
//				url: "http://localhost:8080/teacher/experiment/nothing.do",
//				async: false,
//				dataType: "json",
//				success: function(data) {
//					//alert(data.info);
//					if(data.info == '404') {
//						window.location.href = "../login/teacherlogin.html";
//					}
//				}
//			});
//	var endTime1 = null;
//	var beginTime1 = null;
//	$(function(){
//	    $.ajax({
//	        url:"http://localhost:8080/teacher/onlineTest/find.do",
//	        type:"get",
//	        dataType:"json",
//	        data:$('#testForm').serializeJSON(),
//	        async:false,
//	        success:function(data){
//	            endTime1 = new Date(Date.parse(data.endTime));
//	            beginTime1= new Date(Date.parse(data.beginTime));
//	        },
//	        error:function (data) {
//				alert(666)
//	        }
//	    });
//		
//	})

var sentMessage = function() {
    $.ajax({
        url:"http://localhost:8080/teacher/onlineTest/test.do",
        type:"post",
        dataType:"json",
        data:$('#testForm').serializeJSON(),
        async:false,
        success:function(data){
            alert(data)
        },
        error:function (data) {
			alert(666)
        }
    });
}


layui.use(['form', 'util', 'laydate', 'layer'], function(){
  	var form = layui.form
  	,layer = layui.layer
  	,util = layui.util
  	,laydate = layui.laydate;
  	//监听提交
  	form.on('submit(demo1)', function(data){
        sentMessage();
    	return false;
	});
	
	var timeinfo;
    //固定块
//	util.fixbar({
//	    bar1: true
//	    ,css: {right: 50, bottom: 100}
//	    ,bgcolor: '#393D49'
//		,click: function(type){
//			if(type === 'bar1'){
//		    	layer.msg('剩余时间 : ' + timeinfo)
//			}
//		}
//	});
	//倒计时
//	var thisTimer, setCountdown = function(y, M, d, H, m, s){
//  var endTime = new Date(y, M||0, d||1, H||0, m||0, s||0) //结束日期
//  var serverTime = new Date(); //假设为当前服务器时间，这里采用的是本地时间，实际使用一般是取服务端的
//   
//  	clearTimeout(thisTimer);
//	    util.countdown(endTime, serverTime, function(date, serverTime, timer){
//	    	if(date[1] === 0 && date[2] === 0 && date[3] === 0) {
//  		    //sentMessage();
//	    	}
//		    timeinfo = date[1] + '时' +  date[2] + '分' + date[3] + '秒';
//		    lay('#restOfTheTime').html(timeinfo);
//		    thisTimer = timer;
//	    });
//
//	};
//	setCountdown(endTime1.getFullYear()
//		,endTime1.getMonth()
//		,endTime1.getDate()
//		,endTime1.getHours()
//		,endTime1.getMinutes()
//		,endTime1.getSeconds());
});
</script>



</body>
</html>